package fi.profecons.csswindows.toolkit;

import java.util.ArrayList;
import java.util.List;

import fi.profecons.csswindows.Element;

public class SelectBox extends Element {
	
	private List options = new ArrayList();
	
	private int selected;

	private boolean enabled = true;

	private String name;

	public SelectBox() {
		super();
		addCommand("new SelectBox('" + getId() + "');");
	}
	
	public void addOption(String option){
		this.options.add(option);
		addCommand("getElement('" + getId() + "').addOption('" + option + "');");
	}
	
	public void removeOption(int index){
		this.options.remove(index);
		addCommand("getElement('" + getId() + "').remOption(" + index + ");");
	}
	
	public void select(int index){
		this.selected = index;
		addCommand("getElement('" + getId() + "').select(" + index + ");");
	}
	
	public int getSelectedIndex(){
		return this.selected;
	}

}
